// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   TupleSpaceException.java

package lights.interfaces;

public class TupleSpaceException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = -726798790757361822L;
	private Exception internal;
	private boolean internalFlag;

	public TupleSpaceException(Exception internal) {
		this();
		setInternal(internal);
	}

	public TupleSpaceException() {
		internal = null;
		internalFlag = false;
	}

	public TupleSpaceException(String s) {
		super(s);
		internal = null;
		internalFlag = false;
	}

	public TupleSpaceException(Exception internal, String s) {
		super(s);
		this.internal = null;
		internalFlag = false;
		setInternal(internal);
	}

	public boolean hasInternal() {
		return internalFlag;
	}

	public Exception getInternal() {
		return internal;
	}

	public String toString() {
		String r = super.toString();
		if (internalFlag)
			r = r + ": " + internal.toString();
		return r;
	}

	public void printStackTrace() {
		if (internalFlag) {
			System.err.println(super.toString());
			internal.printStackTrace();
		} else {
			super.printStackTrace();
		}
	}

	private void setInternal(Exception internal) {
		this.internal = internal;
		internalFlag = true;
	}
}
